<template name="stripeMarketplaceSettings">
  {{#unless packageData.settings.api_key}}
  <div class="alert alert-info">
    <span data-i18n="admin.paymentSettings.stripeSettingsDescription">Don't have a Stripe API Secret Key?</span>
    <a href="https://dashboard.stripe.com/account/apikeys" target="_blank">
      <span data-i18n="admin.paymentSettings.stripeSettingsGetItHere">Get it here.</span>
    </a>
  </div>
  {{/unless}}
  <div>
    {{#autoForm collection=Collections.Packages schema=StripePackageConfig doc=packageData type="update" id="stripe-marketplace-update-form"}}
      {{>afQuickField name='settings.api_key'}}
      {{>afQuickField name='settings.public.publishable_key'}}
      <br>
      <span data-i18n="admin.paymentSettings.stripeClientIdWarning">The Client ID is a <strong>PUBLIC</strong> field. Please ensure you're using the `client_id` found on the </span>
      <a target="_blank" href="https://dashboard.stripe.com/account/applications/settings">
        <span data-i18n="admin.paymentSettings.stripeClientIDLink">Stripe Connect Settings</span>
      </a>
      {{>afQuickField name='settings.public.client_id'}}
      <br>
      <span data-i18n="admin.connect.applicationFeeDescription">
        This number represents a percentage fee that the marketplace (this shop) takes for any item which is sold
        by a merchant shop for this marketplace. This fee applies only if Stripe Connect is setup and enabled on both
        the marketplace and the merchant shops and if Stripe is the payment provider used to perform the checkout.
      </span>
      <br>
      <span data-i18n="admin.connect.moreDetails">For more details, see the</span>
      <a target="_blank" href="https://stripe.com/docs/connect/direct-charges#flow-of-funds-with-fees">
        <span data-i18n="admin.connect.docsLink">Stripe Connect Docs</span>
      </a>
      {{>afQuickField name="settings.applicationFee"}}
      <button type="submit" class="btn btn-primary pull-right"><span data-i18n="app.saveChanges">Save Changes</span></button>
    {{/autoForm}}
  </div>
</template>


<template name="stripeMarketplace">
  <div class="container-fluid-sm flex">
    <div class="flex-item">
      <div class="panel panel-default">
        <div class="panel-heading">
          <div class="panel-title">Stripe Checkout</div>
        </div>
        <div class="list-group">
          <div class="list-group-item">
            {{#if packageData.settings.api_key}}
              <span>API Secret Key: <button type="button" class="btn btn-link" data-event-action="showStripeSettings">**********</button></span>
            {{else}}
              <span>API Secret Key: <button type="button" class="btn btn-link" data-event-action="showStripeSettings">Configure Now</button></span>
            {{/if}}
          </div>
        </div>
        <div class="panel-footer">
          <div class="left"></div>
          <div class="right">

            <div class="panel-footer-item">
              {{#if packageData.settings.api_key}}
                <i class="fa fa-check-circle fa-2x text-success"></i>
              {{else}}
                <i class="fa fa-minus-circle fa-2x text-muted"></i>
              {{/if}}
            </div>

            <div class="panel-footer-item">
              <button class="btn btn-default" data-event-action="showStripeSettings">
                <i class="fa fa-gear"></i>
              </button>
            </div>

          </div>
        </div>
      </div>
    </div>
  </div>
</template>
